package com.pb.b2b.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pb.b2b.common.dao.impl.BaseDaoImpl;
import com.pb.b2b.dao.MarkDAO;
import com.pb.b2b.model.Mark;
import com.pb.b2b.model.enums.Status;

@Repository
public class MarkDAOImpl extends BaseDaoImpl implements MarkDAO {
	@Autowired
	SessionFactory sessionFactory;

	public List<Mark> getMarks(Status status) {
		Criteria criteria = sessionFactory.openSession().createCriteria(Mark.class);
		criteria.add(Restrictions.eq("status", status));
		// criteria.addOrder(Order.desc("active"));

		return criteria.list();
	}
}
